Skip to content

Publish documentation #7149

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 14 commits into from
Sep 26, 2022
Merged

Conversation

markrtuttle
Copy link
Collaborator

@markrtuttle markrtuttle commented Sep 22, 2022

This pull request proposes a method of publishing documentation in the diffblue/cbmc repository to the diffblue.github.io/cbmc web site. See this comment for a discussion of the goals. See markrtuttle.github.io/cbmc-documentation for a demonstration.

After merging this pull request, the diffblue/cbmc repository must be configured to publish pages from the branch gh-pages to diffblue.github.io/cbmc. See github instructions to configure from within the account settings (basically two clicks).

There are many known issues. A lot of these comments have to do with using pandoc to remove doxygen issues from markdown files before running doxygen. It is nearly impossible to write markdown files that format cleanly with doxygen and two versions of pandoc and still read well on github as rendered markdown (and still work well with the javascript rendering www.cprover.org/cprover-manual). The biggest issue is that doxygen is written to render markdown snippets from code comments, but does not handle well a collection of basic markdown files that interlink among themselves using classical markdown syntax. Most important, doxygen wants explicitly-declared, globally-unique labels in markdown (that is not supported by classical markdown) for links, and does not follow markdown syntax for linking to sections within a markdown file. We need to make a decision about whether we are writing markdown or doxygen markdown. I recommend (sigh) doxygen markdown and using \page unique-label Heading in place of # Heading. For section labels, without requiring unique section names, the only option appears to be \section unique-label Section in place of ## Section, but that is a massive revision (or just give up on linking directly to section headers).

The modern brew doxygen is 1.9.5 and the ubuntu-latest doxygen on github is 1.8.17. The older version 1.8.17 appears to differ slightly between brew and ubuntu (eg, volume of progress information printed during execution). The newer version 1.9.5 issues warnings that the older version 1.8.17 does not. Differences include some unused variables in doxyfile that are now obsolete, and 500+ new warnings of the form

cbmc/src/util/std_types.h:736: 
   warning: unable to resolve reference to 'code_typet.\ifile' for \ref command
  • This pull request restores two files that may have been deleted from develop:

    • doc/architectural/restrict-function-pointer.md
    • doc/architectural/nondet-volatile.md
  • goto-cc has broken links (what should they link to?):

    -   \ref man_goto-cc-linux "Linux Kernel"
    -   \ref man_goto-cc-apache "Apache HTTPD"
    
  • test_suite.md a broken link (what should it link to?):

    [pid\_test\_suites.xml](pid_test_suites.xml)
    
  • pandoc cannot handle lists or rules that are not preceded by a blank line. In particular, it will try to interpret text immediately following the horizontal rule --- as yaml.

  • pandoc --read markdown sometimes treats doxygen commands like \ingroup as latex commands. Using pandoc --read markdown_phpextra avoids this problem.

  • pandoc --read markdown_phpextra sometimes deletes or modifies fenced code blocks with syntax highlighting like ```c. Using pandoc --read markdown avoids this problem.

  • doxygen cannot handle links [hyper link](url) that break over two lines. Using pandoc --wrap none solves this problem, but now what to use for --read and --write formats (see above).

  • cprover-manual has mutliple sections with same title resulting in nonunique labels for doxygen. Doxygen cannot link to internal sections with [section](#section). Doxygen requires globally unique section labels. This is not supported in straight markdown. The pandoc --write markdown_phpextra will generate the needed section labels, but doxygen complains because they are not unique. For example, in the contracts pages, there are multiple sections named "Overview".

  • cprover-manual does not have top-level sections, and doxygen complains it has subsections outside of sections, etc.

Mark R. Tuttle added 8 commits September 21, 2022 22:36
* Replace top-level section headings with \page command
* Ensure a space between \ingroup and \page for pandoc parsing
* Remove link to cprover-manual index from memory-analyzer,
  restrict-function pointer, etc, and make these pages subpages
  of the top-level architectural page
* Format index.md as nested lists instead of a list of section headings
* Correct broken links
* Add blank link before all lists for pandoc parsing
* Some end-of-line whitespace removed
* Add README files of doc/API and src/goto-harness
* Add surround markdown horizontal rule --- with blank lines for
  pandoc parsing (pandoc will try to interpret text following ---
  as yaml).
* Append "last modified" dates to the end of all markdown files.
* Use a pandoc filter to rewrite links in cprover-manual (links
  originally intended to work with the cprover.org/cprover-manual
  javascripts).
* Add a script to repair fenced code blocks written by pandoc
* doc/ADR
* doc/API
* doc/assets
* doc/cprover-manual
Add top-level user guide, reference guide, developer guide pages for
the new published documentation.  The top-level doxyfile is the
original src/doxyfile with minor modification (eg, project title is
now "CBMC").
@codecov
Copy link

codecov bot commented Sep 22, 2022

Codecov Report

Base: 77.87% // Head: 77.88% // Increases project coverage by +0.00% 🎉

Coverage data is based on head (ee0a06d) compared to base (3034749).
Patch has no changes to coverable lines.

Additional details and impacted files
@@           Coverage Diff            @@
##           develop    #7149   +/-   ##
========================================
  Coverage    77.87%   77.88%           
========================================
  Files         1576     1576           
  Lines       181824   181867   +43     
========================================
+ Hits        141598   141645   +47     
+ Misses       40226    40222    -4     
Impacted Files Coverage Δ
src/util/format_expr.cpp 86.89% <0.00%> (-0.47%) ⬇️
src/util/graph.h 96.83% <0.00%> (-0.32%) ⬇️
src/ansi-c/expr2c.cpp 67.13% <0.00%> (-0.05%) ⬇️
src/ansi-c/c_typecheck_expr.cpp 74.19% <0.00%> (-0.01%) ⬇️
src/util/simplify_expr_class.h 90.47% <0.00%> (ø)
src/goto-symex/goto_symex_state.h 100.00% <0.00%> (ø)
src/goto-programs/validate_goto_model.h 100.00% <0.00%> (ø)
src/goto-programs/validate_goto_model.cpp 100.00% <0.00%> (ø)
unit/goto-programs/goto_program_validate.cpp 100.00% <0.00%> (ø)
src/goto-programs/restrict_function_pointers.h 100.00% <0.00%> (ø)
... and 9 more

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

☔ View full report at Codecov.
📢 Do you have feedback about the report comment? Let us know in this issue.

@feliperodri feliperodri added documentation aws Bugs or features of importance to AWS CBMC users labels Sep 22, 2022
Comment on lines +3 to +5
1. [Introduction](introduction/)

## 2. [Installation](installation/)
2. [Installation](installation/)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@kroening Will this render ok on cprover.org?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

FWIW, I did mention this to @kroening (replacing the sequence of headers with a list) and he did not object.

# Note: Need to read markdown as markdown_phpextra and not default
# markdown to preserve doxygen pragmas like \ingroup.

# Bug: This is currently interacting badly with \dot in cprover markdown
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

To what extent should we be concerned about this? Is there any plan to do something about this?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This preprocessing is required on the cprover-manual pages as long as they are served up by javascript on prover.org. I did a quick scan of the architectural pages, and I saw no obvious problems caused by omitting this preprocessing on the current set of pages. But I think doxygen's brittle treatment of markdown files is a potential issue, and I think we would be better off just deciding to write doxygen-friendly markdown and just living with subpar rendering by other tools (like on github).

Mark R. Tuttle added 3 commits September 22, 2022 13:37
The content of nondet-volatile.md and restrict-function-pointer.md in
doc/architectural has already been moved to the goto-instrument man page.
Remove this also from architectural main page front-page.md
This doxygen file is based on src/doxyfile, and src/doxyfile can be
removed once the run_doxygen continuous integration check is disabled.
@jimgrundy
Copy link
Collaborator

I'd like to see this adopted so that documentation can be maintained more easily and directly from GitHub, and browsable within GitHub and local repos. Further, I'd like to see is declare "Doxygen" and "MarkDown as spoken by Doxygen" become our expected documentation method, which would allow us to strip away a little of the scripting complexity Mark added to support the Markdown as it is today. But, that can wait. Please let's get this in.

@NlightNFotis
Copy link
Contributor

NlightNFotis commented Sep 23, 2022

@jimgrundy Hi Jim, this is on my plate for today - will get this reviewed, but then I'm not sure who else this needs reviews from. I'll see if it needs a couple more from our end if I can chase them further (but please be aware that we've been hit by unexpected illness in our team, so we're missing some of our usual bandwidth).

Copy link
Contributor

@NlightNFotis NlightNFotis left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Some minor comments that don't diminish the ability of this to move forward.

Thank you for your efforts to bring the documentation up to date.

@@ -0,0 +1,3 @@
# CProver APIs
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should be changed to something like:

\page apis CPROVER APIs

Copy link
Collaborator Author

@markrtuttle markrtuttle Sep 25, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This particular proposal won't work because this is the main markdown file for doc/API. The folders doc/API, doc/ADR, and doc/assets are built separately because they don't seem to be linked into the main CPROVER documentation.

I've taken the liberty of converting doc/API and doc/ADR to the doxygen page/subpage syntax.

I was going to do the same for doc/assets, but there is an xml-spec.md that is not linked to by the top-level README, and I wasn't sure which of the various specs are considered authoritative.

@NlightNFotis

* On MacOS,
we recommend installing with [brew](https://brew.sh/):
```
brew install doxygen graphviz
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does this need pandoc as well?

I tried without and got some errors?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've added pandoc to the instructions. I omitted it because it is already installed on the GitHub ubuntu runner. But good catch.

To build the documentation, run

```
doxygen
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There's also a Makefile.

I tried running the default action of the Makefile first, but got a very broken version of the documentation (probably because I was missing stuff from the dependencies?) - which one is the defacto way a developer builds documentation locally? Just running Doxygen, or the Makefile?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good catch. There is now a makefile to automate the five or six invocations of doxygen. The current build command is "make".


## Contribute documentation

Coming soon...
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There appears to be some documentation on this at contributing.md.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added a link. Thanks.

@@ -0,0 +1,60 @@
# CBMC documentation
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should this readme file be lifted to the top-level of the documentation folder, or does it conflict with the compilation of the documentation?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I could go either way. My intention is that this documents the process of building the documentation, and so doesn't belong in the documentation itself. I'm leaving it out for now.

* \ref cprover_documentation
* [CProver Architecture Decision Records](adr/index.html)
* [CProver APIs](api/index.html)
* [CProver assets](assets/index.html)
Copy link
Collaborator

@feliperodri feliperodri Sep 23, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nitpick: s/assets/Assets/g

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done.

@NlightNFotis NlightNFotis merged commit 5834261 into diffblue:develop Sep 26, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
aws Bugs or features of importance to AWS CBMC users aws-high documentation
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants